// var $ = require('jquery');
require('./index.css');
$(function() {
	$('[data-toggle=collapse]').click(function() {
		var html = $(this).html();
		if (html.indexOf('close') > 0) {
			$(this).find('span').removeClass('glyphicon-folder-close').addClass('glyphicon-folder-open');
		} else {
			$(this).find('span').removeClass('glyphicon-folder-open').addClass('glyphicon-folder-close');
			$(this).next().find('[data-toggle]').find('span').removeClass('glyphicon-folder-open').addClass('glyphicon-folder-close');
			$(this).next().find('[data-toggle]').next().removeClass('in');
		}
	});
});

// vue框架数据绑定
new Vue({
	el: '#emcApp',
	data: {
		indexLabel: '首页',
		leftMenus: [{
			href: '#',
			target: '#forGroup',
			span: {
				content: '集团公司'
			},
			isExtend: true,
			nextMenuId: 'forGroup',
			nextMenus: [{
				href: '#',
				target: '#groupStatistic',
				span: {
					content: '集团统计'
				},
				isExtend: true,
				nextMenuId: 'groupStatistic',
				nextMenus: [{
					href: '#',
					frameUrl: './group/group_statistic/energy_statistic.html',
					target: '',
					span: {
						content: '能耗统计'
					}
				}, {
					href: '#',
					frameUrl: './group/group_statistic/income_statistic.html',
					target: '',
					span: {
						content: '收入统计'
					}
				}, {
					href: '#',
					frameUrl: './group/group_statistic/income_rate.html',
					target: '',
					span: {
						content: '收入能耗比'
					}
				}]
			}, {
				href: '#',
				target: '#areaStatistic',
				span: {
					content: '区域统计'
				},
				isExtend: true,
				nextMenuId: 'areaStatistic',
				nextMenus: [{
					href: '#',
					frameUrl: './group/area_statistic/area_energy_statistic.html',
					target: '',
					span: {
						content: '区域能耗统计'
					}
				}, {
					href: '#',
					frameUrl: './group/area_statistic/area_income_statistic.html',
					target: '',
					span: {
						content: '区域收入统计'
					}
				}, {
					href: '#',
					frameUrl: './group/area_statistic/area_income_rate.html',
					target: '',
					span: {
						content: '区域收入能耗比'
					}
				}]
			}]
		}, {
			href: '#',
			target: '#shanghaiGroup',
			span: {
				content: '上海分公司'
			},
			isExtend: true,
			nextMenuId: 'shanghaiGroup',
			nextMenus: [{
				href: '#',
				target: '#shanghaiEnergy',
				span: {
					content: '能耗统计'
				},
				isExtend: true,
				nextMenuId: 'shanghaiEnergy',
				nextMenus: [{
					href: '#',
					frameUrl: './shanghai_group/energy_statistic/shanghai_energy_statistic.html',
					target: '',
					span: {
						content: '能耗分析'
					}
				}, {
					href: '#',
					frameUrl: './shanghai_group/energy_statistic/shanghai_area_statistic.html',
					target: '',
					span: {
						content: '区域能耗占比'
					}
				}]
			}, {
				href: '#',
				target: '#shanghaiShop',
				span: {
					content: '门店能耗排名'
				},
				isExtend: true,
				nextMenuId: 'shanghaiShop',
				nextMenus: [{
					href: '#',
					frameUrl: './shanghai_group/store_rank/top5_energy.html',
					target: '',
					span: {
						content: 'TOP5 能耗排名'
					}
				}, {
					href: '#',
					frameUrl: './shanghai_group/store_rank/top5_area.html',
					target: '',
					span: {
						content: 'TOP5 单位面积能耗排名'
					}
				}, {
					href: '#',
					frameUrl: './shanghai_group/store_rank/top5_employee.html',
					target: '',
					span: {
						content: 'TOP5 单位人能耗排名'
					}
				}]
			}]
		}, {
			href: '#',
			target: '#zhejiangGroup',
			span: {
				content: '浙江分公司'
			}
		}, {
			href: '#',
			target: '#shangsuGroup',
			span: {
				content: '江苏分公司'
			}
		}, {
			href: '#',
			target: '#beijingGroup',
			span: {
				content: '北京分公司'
			}
		}, {
			href: '#',
			target: '#singleShop',
			span: {
				content: '单店分析'
			},
			isExtend: true,
			nextMenuId: 'singleShop',
			nextMenus: [{
				href: '#',
				target: '#singleEnergy',
				span: {
					content: '能耗统计'
				},
				isExtend: true,
				nextMenuId: 'singleEnergy',
				nextMenus: [{
					href: '#',
					frameUrl: './single_store/energy_statistic/single_energy_statistic.html',
					target: '',
					span: {
						content: '能耗分析'
					}
				}, {
					href: '#',
					frameUrl: './single_store/energy_statistic/single_area.html',
					target: '',
					span: {
						content: '区域能耗占比'
					}
				}]
			}, {
				href: '#',
				target: '#singleDetect',
				span: {
					content: '实时检测'
				},
				isExtend: true,
				nextMenuId: 'singleDetect',
				nextMenus: [{
					href: '#',
					frameUrl: './single_store/real_detect/real_energy.html',
					target: '',
					span: {
						content: '区域实时用电'
					}
				}, {
					href: '#',
					frameUrl: './single_store/real_detect/real_warehouse_state.html',
					target: '',
					span: {
						content: '仓库实时用电'
					}
				}]
			}]
		}]
	},
	methods: {
		loadFrame: function(url) {
			document.getElementById('ifrm').src = url;
		}
	}
});